package com.googlecode.imanager.client.util;

import java.util.Collection;
import java.util.Set;

/**
 * 
 * Note: <code>null</code> is not allowed and a child object can't be added
 * more than once.
 * 
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class UniqueList<Child> extends SharedList<Child> implements Set<Child> {

    private static final long serialVersionUID = 1L;
        
    public UniqueList() {
        super();
    }

    public UniqueList(Collection<? extends Child> list) {
        super(list);
    }

    public UniqueList(int capacity) {
        super(capacity);
    }

    @Override
    protected boolean isDuplicated(Child item){
        return contains(item);
    }
    
    @Override
    protected boolean isValidItem(Child item){
        return item != null;
    }

}
